Using Zip and other File Compression Methods

Zip files are compressed file archives. A zip file can have many files in it, which is handy for saving or uploading or downloading, because you have only one file to deal with.

To see the files in a zip archive you have to unpack them, which is called "unzipping" the archive.

Zip files were originally created on Windows using the PKZIP program. It was a text based program with no windows interface. There are now fancy window interfaces to use with PKZIP, and it's available on Mac and Linux.

On Macintosh, most people use "Stuffit" to unpack Zip files. Stuffit can handle a number of other formats.

Another popular program is Zipeg, a free program you can download.

CREATING A ZIP ARCHIVE USING THE TEXT INTERFACE

I will do this example on a Mac, but it's about the same on other systems.

I'm going to make an archive out of four PDF files of guitar music.

First I'm going to list the files to see how big they are.

Jims-MacBook:~ deborahroetman$ ls -al gui*
   -r--------  1 deborahroetman  deborahroetman  544110 Jun 14 12:57 guitar cueca.pdf
   -rw-r--r--@ 1 deborahroetman  deborahroetman  146262 Sep 13 21:27 guitar-camino-de-felanitx.pdf
   -rw-r--r--@ 1 deborahroetman  deborahroetman   47158 Sep 13 21:26 guitar-good-doctor.pdf
   -rw-r--r--@ 1 deborahroetman  deborahroetman   85400 Sep 13 21:25 guitar-margarideta.pdf

Create the archive

 Jims-MacBook:~ deborahroetman$   Jims-MacBook:~ deborahroetman$ zip myguitarmusic.zip guitar*
 adding: guitar cueca.pdf (deflated 80%)
 adding: guitar-camino-de-felanitx.pdf (deflated 35%)
 adding: guitar-good-doctor.pdf (deflated 45%)
 adding: guitar-margarideta.pdf (deflated 38%)

Let's see how big that archive is

 Jims-MacBook:~ deborahroetman$ ls -al myguitarmusic.zip
   -rw-r--r--  1 deborahroetman  deborahroetman  284394 Nov 16 08:44 myguitarmusic.zip

It looks like the archive is about half the size of the biggest of the four files in it.

CREATING A PASSWORD PROTECTED ZIP ARCHIVE

To add a password to an archive, just use the "e" option, like this:

zip -e myzipfile.zip file1.txt file2.txt  

Once you enter the command, system will prompt you for password twice. Just enter the password you wish to set, and it’s done! If you list the files, you should see myzipfile.zip appear in the directory.

OPENNING A PASSWORD PROTECTED ZIP ARCHIVEUSING ZIPEG

Mac computers can't open password protected zip file with the default Archive Utility. If the zip file is password protected, you need third party tools to open the zip file. To open password protected zip in Mac OS X, follow the steps below

Download zipeg from http://www.zipeg.com Zipeg is a freeware

Double click the file and drag the little sheep to your “Application” folder”

Double click zipeg and start the program

Now drag your password protected to zipeg and it will prompt you for your password

Once you enter the correct password, you will be able to access your files. or click on Extract button to extract it.